#include <stdio.h>
#define INF 10000
#define max(a,b) (a>b?a:b)
int main(){
	int a[3][INF]={0};
	int n[3];
	int c=0;
	int i1=0,i2=0;
	for(i1=0;i1<2;i1++){
		printf("Input n:");
		scanf("%d",&n[i1]);
		for(i2=0;i2<n[i1];i2++){
			scanf("%d",&a[i1][i2]);
		}
	}
	
	for(i1=0;i1<2;i1++){
		for(i2=0;i2<n[i1];i2++){
			printf("%d\t",a[i1][i2]);
		}
		printf("\n");
	}
	
	int i3=0;
	n[2]=max(n[0],n[1])+1;
	for(i3=0;i3<=n[2];i3++){
		a[2][i3]=a[0][i3]+a[1][i3]+c;
		c= a[2][i3]>1?1:0;
		a[2][i3]%=2;	
	}
	
	if(a[2][n[2]]!=0)
		printf("%d",a[2][n[2]]);
	for(i3=n[2]-1;i3>=0;i3--){
		printf("%d",a[2][i3]);
	}	
	printf("\n");
		
	return 0;
}
